    <?php
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
class Template {
    private static $dot ='.';
    private static $_instance ; 
    public static function callMethod(){
        self::$_instance = new self ; 
        return self::$_instance ;
    }
    public static function renderTemplate($name,$path,$extention = NULL){
        $extention != '' ? $extention = self::$dot.$extention : $extention = '.php';
        $templateName = $path.$name.$extention;
            if(file_exists($templateName)) {
            require_once ($templateName);
        } else {
            echo  new ErrorException($fiileName. "Is not exists.");
        }    
    }
    public static function renderCss(){
        global $cssArray  ; 
        $countCssArray = count($cssArray) ; 
        $cssStr = '';
        $cssPath = MAGIC_CSS_PATH ;
        for($i=0;$i<$countCssArray;$i++) {
            $cssStr .= '<link rel="stylesheet" type="text/css" href="'.$cssPath.$cssArray[$i].'" />';
        }
        return $cssStr ; 
    }
    public static function renderJs(){
        global $jsArray  ; 
        $countJsArray = count($jsArray) ; 
        $jsStr = '';
        $jsPath = MAGIC_JS_PATH;
        for($i=0;$i<$countJsArray;$i++) {
            $jsStr .= '<script type="text/javascript" src="'.$jsPath.$jsArray[$i].'"></script>';
        }
        return $jsStr ; 
    }
    public static function setDisplay($name,$value){
        $GLOBALS[$name]=$value ;
    }
    public static function getDisplay($name){
        return $GLOBALS[$name] ;
    }

}

?>
